<template>
  <div id="sendwrite">
    <div class="sendtop">
      <div class="ebtop">
        <div class="left">站内信</div>
      </div>
        <!-- 写信页面 -->
        <div class="sendwrite">
            <div class="people">发件人：&emsp;<span>{{name}}</span></div>
            <div class="content">发送内容：<textarea style="resize:none" required placeholder="请输入你想要发给后台的内容" v-model="content"></textarea></div>
            <div class="btn">
                <button @click="sendTo">确定发送</button>
                <button @click="sendClose">取消</button>
            </div>
        </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "sendwrite",
  data() {
    return {
      // checkAll: false,
      // checked: [],
      status: ["未受理", "已受理"],
      name: "你好",
      content: ""
    };
  },
  mounted() {
    this.loadmes();
  },

  methods: {
    sendTo() {
      if (!this.content) {
        this.$message({ message: "请输入内容", type: "error" });
      } else {
        this.axios.post("User/message_cl", {
          content: this.content
        })
        .then(({ data }) => {
          console.log(data);
          if (data.status === "1") {
            this.$message({ message: "发送成功", type: "success" });
            this.$router.push("sendmes");
          } else if (data.status === "2") {
            this.$message({ message: "发送失败", type: "error" });
          }
        })
        .catch(function(error) {
          console.log(error);
        });
      }
    },
    sendClose() {
      this.$router.push("sendmes");
    }
  }
};
</script>
<style lang="scss">
#sendwrite {
  height: 100%;
  position: relative;
  .ebtop {
    // width: 100%;
    height: 55px;
    padding: 0 83px 0 25px;
    box-sizing: border-box;
    border-bottom: 1px solid rgba(153, 153, 153, 1);
    box-shadow: 0 -10px #f2f2f2;
    background-color: #fff;
    z-index: 99;
    .left {
      font-size: 13px;
      font-family: MicrosoftYaHei-Bold;
      color: rgba(0, 0, 0, 1);
      font-weight: 700;
      line-height: 65px;
    }
  }
  .sendwrite {
    position: absolute;
    top: 55px;
    bottom: 0px;
    right: 0px;
    left: 0px;
    padding: 25px;
    .people {
      font-size: 14px;
    }
    .content {
      margin-top: 20px;
      width: 100%;
      height: 80%;
      textarea {
        margin-top: 10px;
        margin-left: 60px;
        margin-right: 20px;
        width: 92%;
        height: 100%;
      }
    }
  }
  .btn {
    margin-top: 60px;
    button {
      cursor: pointer;
      width: 82px;
      height: 33px;
      background: rgba(224, 3, 0, 1);
      font-size: 12px;
      font-family: MicrosoftYaHei;
      color: rgba(255, 255, 255, 1);
      border-radius: 2px;
    }
    button:nth-of-type(2) {
      margin-left: 25px;
      background: rgba(225, 225, 225, 1);
      color: rgba(0, 0, 0, 1);
    }
  }
}
</style>
